'''
Created on 04.06.2013

@author: Thom
'''

from dame.Game import CheckersBoard
from dame.Game import Stone
from dame.Interfaces import Move

board = CheckersBoard()
board.printOut()

print("")
print("move")

board.addStone(Stone(board._black, [2,2]))
board.removeStone([3, 2])
board.printOut()

moves = board.getAllMoves()
for move in moves:
    move.printOut()
    
print("")
print("move")

board._playerToMove = board._black
board.removeStone([2, 2])
board.moveStone([1, 2], [3, 2])
board.printOut()

moves = board.getAllMoves()
for move in moves:
    move.printOut()

print()
print("isPossibleTests")
move1 = Move(board._white, 3, 2, 2, 2, -1, -1)
print("is possible [3, 2] -> [2, 2] for white ", board.possibleMove(move1))
move1.player = board._black
print("is possible [3, 2] -> [2, 2] for black ", board.possibleMove(move1))
move1.from_x = 4
move1.from_y = 2
move1.rem_x = 3
move1.rem_y = 2
print("is possible [4, 2] -> [2, 2] for black ", board.possibleMove(move1))

print()
print("iterator test")
while board.hasNextMove():
    move = board.getNextMove()
    move.printOut()
    
print()
print("doMove test")
print("player before move: ", board._playerToMove, "; 1 = white, 2 = black")
board.doMove(move1)
board.printOut()
print("player after move: ", board._playerToMove, "; 1 = white, 2 = black")

print()
print("move history")
for move in board.getMoveHistory():
    move.printOut()
print("state history")
for state in board.getStateHistory():
    state.printOut()

print()
print("undo move")
undoMove = Move(board._white, 4, 2, 2, 2, 3, 2)
board.undoMove(undoMove)
board.printOut()
print()
board.undoMove(Move(board._black, 4, 2, 2, 2, 3, 2))
board.printOut()

print()
print("move history")
for move in board.getMoveHistory():
    move.printOut()
print("state history")
for state in board.getStateHistory():
    state.printOut()